.TH "Zebulon::VisionUtils" 3 "13 Oct 2009" "Version 2" "zebulon" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Zebulon::VisionUtils \- 
.PP
Class with useful computer vision functions.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <visionutils.h>\fP
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static void \fBExtractColor\fP (const IplImage *img, IplImage *dest, const CvScalar sampleColor, const int threshold=10, const int dilate=0)"
.br
.RI "\fICalculates a new single channel 8 bit image where the color desired is white, and every other color is black. Image is the same size as the source image. New memory is allocated, so returned image must be released when done with it. \fP"
.ti -1c
.RI "static void \fBExtractColor\fP (const IplImage *img, IplImage *dest, const CvScalar sampleStart, const CvScalar sampleEnd, const int threshold=10, const int dilate=0)"
.br
.RI "\fICalculates a new single channel 8 bit image where the color desired is white, and every other color is black. Image is the same size as the source image. New memory is allocated, so returned image must be released when done with it. \fP"
.ti -1c
.RI "static IplImage * \fBBackProject\fP (const IplImage *img, const IplImage *sampleHistImg, const int threshold=10, const int dilate=0)"
.br
.ti -1c
.RI "static IplImage * \fBRotate90\fP (const IplImage *img, const int angle=90, const int orientation=CV_CLOCKWISE)"
.br
.RI "\fIRotates an image in 90 degree increments, adjusting for aspect ratio. returned image may be of different size than source. \fP"
.ti -1c
.RI "static double \fBGetAngle\fP (const CvPoint *pt1, const CvPoint *pt2, const CvPoint *pt0)"
.br
.RI "\fIReturns an angle between 3 points. Original source taken from opencv square.c in example programs. \fP"
.ti -1c
.RI "static IplImage * \fBCrop\fP (const IplImage *img, const CvBox2D cropArea)"
.br
.RI "\fICrops a portion of an image given a box of equal or smaller width and height to the source image. Crop area does not have to be parallel to sides of image. Allocates new memory for crop and must be release when done with it. \fP"
.ti -1c
.RI "static void \fBGetContourSimilarity\fP (const IplImage *toMatch, const IplImage *tmplt, double &similarity)"
.br
.RI "\fIReturns a measure of similarity of 2 images by comparing contours found in the image. Scale, rotation, translation invariant. \fP"
.ti -1c
.RI "static void \fBGetTemplateSimilarity\fP (const IplImage *toMatch, const IplImage *tmplt, double &similarity)"
.br
.RI "\fIReturns a measure of similarity of 2 images by comparing pixels found in the image. scale invariant, Only slightly rotation invariant. Not translation invariant. \fP"
.ti -1c
.RI "static std::list< CvBox2D > \fBFindSquares\fP (const IplImage *img, IplImage *dest, const double minsize=.05, const double maxsize=.75, const int cannyThreshold=50, const bool angle3d=false)"
.br
.RI "\fIReturns a std linked list of cvBox2D objects sorted from big to small found in source image using a combination of thresholding and edge detection. Original source taken from square.c in opencv example programs. \fP"
.ti -1c
.RI "static void \fBDrawSquare\fP (IplImage *img, const CvSeq *squares, CvScalar color=cvScalar(255, 255, 255), int thickness=3)"
.br
.ti -1c
.RI "static void \fBDrawSquare\fP (IplImage *img, const CvBox2D square, const CvScalar color=cvScalar(255, 255, 255), const int thickness=3)"
.br
.RI "\fIDraws cvbox2ds on an image. \fP"
.ti -1c
.RI "static std::list< CvBox2D > \fBGetBlobBoxes\fP (const IplImage *img, const double minsize=.05, const double maxsize=.95)"
.br
.RI "\fIReturns a stl list of cvBox2D objects around blobs found in an image in order of biggest to smallest. \fP"
.ti -1c
.RI "static double \fBExtractBiggestBlob\fP (const IplImage *img, IplImage *dest, CvBox2D &biggestBox, const double minsize=.01, const double maxsize=.95)"
.br
.RI "\fIReturns an image which cropped out of the original on the biggest blob. \fP"
.ti -1c
.RI "static void \fBSquareDiff\fP (const IplImage *img1, const IplImage *img2, IplImage *dest)"
.br
.RI "\fICalculates the squared difference of an image and a scalar, must have the same number of channels. \fP"
.ti -1c
.RI "static void \fBSquareDiffS\fP (const IplImage *img1, IplImage *dest, const CvScalar val)"
.br
.RI "\fICalculates the squared difference of an image and a scalar, must have the same number of channels. \fP"
.ti -1c
.RI "static uchar \fBGetPixel\fP (IplImage *img, int row, int col, int channel)"
.br
.RI "\fIReturns a single pixel from a IplImage, with no bounds checking. Code found on google. \fP"
.ti -1c
.RI "static IplImage * \fBRGBToCustom\fP (const IplImage *img)"
.br
.ti -1c
.RI "static void \fBCvtBRG2HSL\fP (const IplImage *src, IplImage *dest)"
.br
.RI "\fIConverts an IplImage in the BRG color space to the HSL color space. \fP"
.ti -1c
.RI "static void \fBCvtBRG2HSL\fP (const CvScalar &src, CvScalar &dest)"
.br
.ti -1c
.RI "static double \fBPointLineDistance\fP (const CvScalar &p1, const CvScalar &p2, const CvScalar &p3, const int dimensions=3)"
.br
.ti -1c
.RI "static double \fBDist\fP (const CvScalar &p1, const CvScalar &p2, int dimensions=3)"
.br
.ti -1c
.RI "static bool \fBCalc3DSquareAngle\fP (CvSeq *&polySquareApprox, float &angle, IplImage *dest=NULL)"
.br
.RI "\fIReturns a cvSequence of points that represents corners of squares found in source image using a combination of thresholding and edge detection. Original source taken from square.c in opencv example programs. \fP"
.in -1c
.SH "Detailed Description"
.PP 
Class with useful computer vision functions. 
.SH "Member Function Documentation"
.PP 
.SS "bool VisionUtils::Calc3DSquareAngle (CvSeq *& polySquareApprox, float & angle, IplImage * dest = \fCNULL\fP)\fC [static]\fP"
.PP
Returns a cvSequence of points that represents corners of squares found in source image using a combination of thresholding and edge detection. Original source taken from square.c in opencv example programs. \fBParameters:\fP
.RS 4
\fIimg\fP Source image. 
.br
\fIstorage\fP memory to store contour and sequence data. 
.br
\fIcannyThreshold\fP threshold used for edge detection
.RE
.PP
\fBReturns:\fP
.RS 4
cvSequence of points that represent corners of squares found in image. 
.RE
.PP

.SS "IplImage * VisionUtils::Crop (const IplImage * img, const CvBox2D box)\fC [static]\fP"
.PP
Crops a portion of an image given a box of equal or smaller width and height to the source image. Crop area does not have to be parallel to sides of image. Allocates new memory for crop and must be release when done with it. \fBParameters:\fP
.RS 4
\fIimg\fP Source image. 
.br
\fIcropArea\fP Area to crop.
.RE
.PP
\fBReturns:\fP
.RS 4
new image of the crop area. 
.RE
.PP

.SS "void VisionUtils::CvtBRG2HSL (const IplImage * src, IplImage * dest)\fC [static]\fP"
.PP
Converts an IplImage in the BRG color space to the HSL color space. \fBParameters:\fP
.RS 4
\fIsrc\fP Source image. 
.br
\fIdest\fP image that conversion goes to. 
.RE
.PP

.SS "void VisionUtils::DrawSquare (IplImage * img, const CvBox2D square, const CvScalar color = \fCcvScalar(255,255,255)\fP, const int thickness = \fC3\fP)\fC [static]\fP"
.PP
Draws cvbox2ds on an image. \fBParameters:\fP
.RS 4
\fIimg\fP Source image. Must be an 8 bit single channel image. 
.br
\fIsquare\fP squre to draw 
.br
\fIcolor\fP color of square as cv scalar RGB 
.br
\fIthickness\fP of lines 
.RE
.PP

.SS "double VisionUtils::ExtractBiggestBlob (const IplImage * img, IplImage * dest, CvBox2D & biggestBox, const double minsize = \fC.01\fP, const double maxsize = \fC.95\fP)\fC [static]\fP"
.PP
Returns an image which cropped out of the original on the biggest blob. \fBParameters:\fP
.RS 4
\fIimg\fP Source image. Must be an binary single channel image. 
.br
\fIdest\fP Destination image. Must be same size as img. A box around biggets blob will be drawn to this img. NULL if no destination image is required. 
.br
\fIbiggestBox\fP box that describes blob position and orientation.
.RE
.PP
\fBReturns:\fP
.RS 4
Area of blob in pixels 
.RE
.PP

.SS "void VisionUtils::ExtractColor (const IplImage * img, IplImage * dest, const CvScalar sampleStart, const CvScalar sampleEnd, const int threshold = \fC10\fP, const int dilate = \fC0\fP)\fC [static]\fP"
.PP
Calculates a new single channel 8 bit image where the color desired is white, and every other color is black. Image is the same size as the source image. New memory is allocated, so returned image must be released when done with it. \fBParameters:\fP
.RS 4
\fIimg\fP Source image we want to extract color from. Must be 3 channel 8 bit image. 
.br
\fIsampleColor\fP scalar representing the color we want to extract as a 3 channel 8 bit scalar. 
.br
\fIthreshold\fP threshold value to apply on the result. Lower is stricter. threshold of 0 will not do any thresholding and return grayscale img. 
.br
\fIdilate\fP dilate the results to increase size of any color found, useful to connect the dots of splotchy images. Higher number will dilate spots more.
.RE
.PP
\fBReturns:\fP
.RS 4
A new image that represents a binary mask of where the color was found in the source image. Must be released when done. 
.RE
.PP

.SS "void VisionUtils::ExtractColor (const IplImage * img, IplImage * dest, const CvScalar sampleColor, const int threshold = \fC10\fP, const int dilate = \fC0\fP)\fC [static]\fP"
.PP
Calculates a new single channel 8 bit image where the color desired is white, and every other color is black. Image is the same size as the source image. New memory is allocated, so returned image must be released when done with it. \fBParameters:\fP
.RS 4
\fIimg\fP Source image we want to extract color from. Must be 3 channel 8 bit image. 
.br
\fIdest\fP Destination image same size and type as source image where binary color mask will be stored. 
.br
\fIsampleColor\fP scalar representing the color we want to extract as a 3 channel 8 bit scalar. 
.br
\fIthreshold\fP threshold value to apply on the result. Lower is stricter. threshold of 0 will not do any thresholding and return grayscale img. 
.br
\fIdilate\fP dilate the results to increase size of any color found, useful to connect the dots of splotchy images. Higher number will dilate spots more. 
.RE
.PP

.SS "std::list< CvBox2D > VisionUtils::FindSquares (const IplImage * img, IplImage * dest, const double minsize = \fC.05\fP, const double maxsize = \fC.75\fP, const int cannyThreshold = \fC50\fP, const bool angle3d = \fCfalse\fP)\fC [static]\fP"
.PP
Returns a std linked list of cvBox2D objects sorted from big to small found in source image using a combination of thresholding and edge detection. Original source taken from square.c in opencv example programs. \fBParameters:\fP
.RS 4
\fIimg\fP Source image, can be color or grayscale. 
.br
\fIdest\fP Image to draw boxes on to, can be NULL 
.br
\fIminsize\fP min percentage of total pixels before square is considred 
.br
\fImaxsize\fP max percentage of total pixels before square is considred 
.br
\fIcannyThreshold\fP threshold used for edge detection
.RE
.PP
\fBReturns:\fP
.RS 4
std linked list of cvBox2D objects sorted from bigest to smallest 
.RE
.PP

.SS "double VisionUtils::GetAngle (const CvPoint * pt1, const CvPoint * pt2, const CvPoint * pt0)\fC [static]\fP"
.PP
Returns an angle between 3 points. Original source taken from opencv square.c in example programs. \fBParameters:\fP
.RS 4
\fIpt1\fP First point in the angle 
.br
\fIpt2\fP Second point in angle 
.br
\fIpt0\fP point at which we are measuring angle from pt1 to pt2
.RE
.PP
\fBReturns:\fP
.RS 4
angle between points, in radians 
.RE
.PP

.SS "std::list< CvBox2D > VisionUtils::GetBlobBoxes (const IplImage * img, const double minsize = \fC.05\fP, const double maxsize = \fC.95\fP)\fC [static]\fP"
.PP
Returns a stl list of cvBox2D objects around blobs found in an image in order of biggest to smallest. \fBParameters:\fP
.RS 4
\fIimg\fP Source image. Must be a binary image. 
.br
\fIminsize\fP minimum size acceptable to put a box around, as a percentage of the total area of the source image. 
.br
\fImaxsize\fP maximum size acceptable to put a box around, as a percentage of the total area of the source image.
.RE
.PP
\fBReturns:\fP
.RS 4
stl list of cvbox2d objects around blobs. 
.RE
.PP

.SS "void VisionUtils::GetContourSimilarity (const IplImage * toMatch, const IplImage * tmplt, double & similarity)\fC [static]\fP"
.PP
Returns a measure of similarity of 2 images by comparing contours found in the image. Scale, rotation, translation invariant. \fBParameters:\fP
.RS 4
\fItoMatch\fP Source image. Must be a single channel binary 8 bit image. 
.br
\fItmplt\fP Template to match to, must be single channel binary 8 bit image. 
.br
\fImemory\fP storage to allocated contour data. 
.br
\fIsimilarity\fP the similarity measure, closer to 1 is more similar. 
.RE
.PP

.SS "uchar VisionUtils::GetPixel (IplImage * img, int row, int col, int channel)\fC [static]\fP"
.PP
Returns a single pixel from a IplImage, with no bounds checking. Code found on google. \fBParameters:\fP
.RS 4
\fIimg\fP iplimage where we want to get pixel 
.br
\fIrow\fP row the pixel is on 
.br
\fIcol\fP column the pixel is on 
.br
\fIchannel\fP channel the pixel is on, 0 if single channel image.
.RE
.PP
\fBReturns:\fP
.RS 4
pixel from image as an unsigned char. 
.RE
.PP

.SS "void VisionUtils::GetTemplateSimilarity (const IplImage * toMatch, const IplImage * tmplt, double & similarity)\fC [static]\fP"
.PP
Returns a measure of similarity of 2 images by comparing pixels found in the image. scale invariant, Only slightly rotation invariant. Not translation invariant. \fBParameters:\fP
.RS 4
\fItoMatch\fP Source image. Must be a single channel binary 8 bit image. 
.br
\fItmplt\fP Template to match to, must be single channel binary 8 bit image. 
.br
\fIsimilarity\fP the similarity measure, closer to 1 is more similar. 
.RE
.PP

.SS "IplImage * VisionUtils::Rotate90 (const IplImage * img, const int angle = \fC90\fP, const int orientation = \fCCV_CLOCKWISE\fP)\fC [static]\fP"
.PP
Rotates an image in 90 degree increments, adjusting for aspect ratio. returned image may be of different size than source. \fBParameters:\fP
.RS 4
\fIimg\fP Source image we want to rotate 
.br
\fIangle\fP angle in degrees, any multiple of 90 is valid 
.br
\fIorientation\fP CV_CLOCKWISE or CV_COUNTER_CLOCKWISE indicating direction of rotation.
.RE
.PP
\fBReturns:\fP
.RS 4
IplImage that represents the new rotation. New memory is allocated and must be released when finished with image. 
.RE
.PP

.SS "void VisionUtils::SquareDiff (const IplImage * img1, const IplImage * img2, IplImage * dest)\fC [static]\fP"
.PP
Calculates the squared difference of an image and a scalar, must have the same number of channels. \fBParameters:\fP
.RS 4
\fIimg1\fP image we are taking squared diff 
.br
\fIimg2\fP image we are taking squared diff 
.br
\fIdest\fP the image that will store squared diffs 
.RE
.PP

.SS "void VisionUtils::SquareDiffS (const IplImage * img1, IplImage * dest, const CvScalar val)\fC [static]\fP"
.PP
Calculates the squared difference of an image and a scalar, must have the same number of channels. \fBParameters:\fP
.RS 4
\fIimg1\fP image we are taking squared diff 
.br
\fIdest\fP the image that will store squared diffs 
.br
\fIval\fP the scalar we are taking quared diff of 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for zebulon from the source code.
